package com.kingyea.mobilepolice.apimanage.specification;

/**
 * @author cxc
 * @version v1.0.0
 * @description
 * @date Created in 2018-05-10 14:36
 */
public enum ResponseCode {

    SUCCESS(10, "请求成功"), QUERY_PARAM_IS_NULL(11, "请求失败，参数缺失"), QUERY_PARAM_IS_FAIL(11, "请求失败，参数错误"), QUERY_PARAM_IS_ERROR(12, "请求失败，参数不是指定结构，无法解析"), QUERY_TARGET_IS_NULL(13, "请求失败，请求目标不存在"), ERROR(19, "请求失败，服务出错");

    private Integer code;
    private String msg;

    ResponseCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static boolean contains(String s) {
        for (ResponseCode code : values()) {
            if (code.name().equalsIgnoreCase(s)) {
                return true;
            }
        }
        return false;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @Override
    public String toString() {
        return this.name();
    }
}
